#include<iostream> 

using namespace std;

const int N = 1e5 +10;

int n, m;
int a[N], b[N];

int main(){
    cin >> n >> m;
    for(int i = 0; i < n; i ++ ) scanf("%d", &a[i]);
    for(int i = 0; i < m; i ++ ) scanf("%d", &b[i]);
    
    int i = 0, j = 0;
    for( ;j < m; j ++ )
       if(a[i] == b[j]) i ++;
    if(i == n) cout <<"Yes\n";
    else cout << "No\n";

    return 0;
}
